
void check(string &str) {
    vector<string > vec;
    for (int i = 0; i < str.size(); i++) {
        vec.push_back(str.substr(i));
    }

    reverse(vec.begin(), vec.end()); //不是必须
    for (int i = 0; i < vec.size(); i++) {
        string curr = vec[i];
        for (int j = i + 1; j<vec.size(); j++) {
            string search = vec[j];
            int len = curr.size()<search.size()? curr.size(): search.size();
            int substr = 0;
            for (int k = 0; k < len; k++) {
                if (curr[k] == search[k]) {
                    substr++;
                    continue;
                }
                break;
            }
            cout << substr << endl;

        }

    }
}